package com.wzy.domain.entity;

import lombok.Getter;

import java.util.HashMap;
import java.util.Map;

/**
 * 消息事件实体
 *
 * @author ultima
 * @version 2022/10/26 19:24
 */
@Getter
public class Event
{
    /**
     * 主题
     */
    private String topic;

    /**
     * 触发事件的用户ID
     */
    private Long userId;

    /**
     * 触发事件的用户昵称
     */
    private String userNick;

    /**
     * 触发事件的用户头像
     */
    private String avatarUrl;

    /**
     *
     */
    private Long entityType;

    /**
     * 实体主键
     */
    private Long entityId;

    /**
     * 目标用户ID
     */
    private Long entityUserId;

    /**
     * 其他数据
     */
    private Map<String, Object> data = new HashMap<>();

    public Event setTopic(String topic)
    {
        this.topic = topic;
        return this;
    }

    public Event setUserId(Long userId)
    {
        this.userId = userId;
        return this;
    }

    public Event setUserNick(String userNick)
    {
        this.userNick = userNick;
        return this;
    }

    public Event setAvatarUrl(String avatarUrl)
    {
        this.avatarUrl = avatarUrl;
        return this;
    }

    public Event setEntityType(Long entityType)
    {
        this.entityType = entityType;
        return this;
    }

    public Event setEntityId(Long entityId)
    {
        this.entityId = entityId;
        return this;
    }

    public Event setEntityUserId(Long entityUserId)
    {
        this.entityUserId = entityUserId;
        return this;
    }

    public Event setData(String key, Object value)
    {
        this.data.put(key, value);
        return this;
    }
}
